﻿package com.bike.util;

import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StrUtil {
	public static String getRandomToken(String prefix){
		UUID uuid=UUID.randomUUID();
		return prefix+uuid.toString().replaceAll("-","");
	}
	
	public static String getFilterPhone(String phone){
		return phone.substring(0,3).concat("****").concat(phone.substring(8, 11));
	}
	
	public static void main(String[] args) {
		System.out.println(getRandomToken("cai"));
		System.out.println(getFilterPhone("13126506185"));
	}
	 public static boolean isChinaPhoneLegal(String str)   {  
	        String regExp = "^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";  
	        Pattern p = Pattern.compile(regExp);  
	        Matcher m = p.matcher(str);  
	        return m.matches();  
	 }  
}